From: Keir Fraser Date: Tue, 23 Jun 2009 10:27:54 +0000 (+0100) Subject: xenconsoled: fix timestamp log X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13710 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22%22?a=commitdiff_plain;h=a114a32c90fb4a3d249de760869cd57d750dff90;p=xen.git xenconsoled: fix timestamp log timestamp log is broken. Also, xenconsoled might die with segfault. Signed-off-by: Kouya Shimura --- diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 11e0950595..67fb22c612 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -127,7 +127,7 @@ static int write_with_timestamp(int fd, const char *data, size_t sz, const char *last_byte = data + sz - 1; while (data <= last_byte) { - const char *nl = memchr(data, '\n', sz); + const char *nl = memchr(data, '\n', last_byte + 1 - data); int found_nl = (nl != NULL); if (!found_nl) nl = last_byte;